/*------------------------------------------------------------------------------
*** PURPOSE: 	The following do-file generates Table 4 in the Appendix of the
				paper "Respondent biases in household surveys" by Andrew Dillon 
				and Edouard Romeo Mensah. 

*** NOTE:		Relevant globals are defined in the do-file titles "master.do"
				contained in the folder "02_do" in the replication package.
------------------------------------------------------------------------------*/


	* Appendix Table 4. Treatment effects on labor.
	
	* Without unbalanced covariates and without gender interaction with treatment.
	* S.E. clustered at village-level: All villages included.
	
			eststo clear
			foreach i in $depvars4_app {
				reg `i' i.treat1_hhead i.treat2_rproxy, vce(cluster village)
				qui sum `i' if e(sample) & treatarm==0
				local ctrlmean=r(mean)
				local ctrlsd=r(sd)
				testparm i.treat1_hhead i.treat2_rproxy
				local pvalue_all=r(p)
				lincom 1.treat1_hhead - 1.treat2_rproxy
				local Treat1_2_coef=r(estimate)
				local Treat1_2_t=r(estimate)/r(se)
				local Treat1_2_p= tprob(r(df),abs(`Treat1_2_t'))	
				eststo `i'_A, addscalars(pvalue_all `pvalue_all' Controlmean `ctrlmean' Controlsd `ctrlsd' ///
				Treat1_2_coef `Treat1_2_coef' Treat1_2_t `Treat1_2_t' pvalue_b1_b2 `Treat1_2_p')
			}
			
			
				
			esttab *_A using "04_output\Appendix Table 4. Treatment effects on labor.csv", se ///
			scalars("pvalue_b1_b2 p-value: test of T1=T2" "pvalue_all p-value: joint test of T1 and T2" N "Controlmean Control Mean" "Controlsd Control S.D.") sfmt(3 3 0 3 3) ///
			title("Appendix Table 4: Treatment effects on labor") ///
			mtitles("Log unpaid household male labor (person-days/year)" "Log unpaid household female labor (person-days/year)" "Log unpaid household child labor (person-days/year)" "Log total unpaid household labor (person-days/year)" "Log unpaid non-household labor of relatives (person-days/year)" "Log unpaid non-household labor of non-relatives (person-days/year)" "Log total unpaid non-household labor (person-days/year)" "HH used salaried labor" "Log total child labor (person-days/year)" "Log total labor (person-days/year)" "Log total payment of labor -- unconditional (USD/year)" "Log total labor per hectare (person-days/year/ha)" "Log total payment of labor per hectare -- unconditional (USD/year/ha)" "Log total payment of labor per hectare -- conditional (USD/year/ha)") ///
			nonotes addnotes("All standard errors are clustered at the village level. *** p<0.01; ** p<0.05; * p<0.1." "Estimated without unbalanced covariates and without gender interaction with treatment.") star(* 0.1 ** 0.05 *** 0.01) ///
			coeflabels(1.treat1_hhead "T1: HH Head" 1.treat2_rproxy "T2: Random Proxy") drop(0.treat1_hhead 0.treat2_rproxy _cons) ///
			b(3) se(3) noobs width(25) replace
			
			estimates clear	